from django.urls import re_path, include
from api import views
from rest_framework import routers
from rest_framework_jwt.views import obtain_jwt_token

# 可以处理视图的路由器
router = routers.DefaultRouter()
# 向路由器中注册视图集,两个参数，一个是匹配的路由，一个是视图中写的CBV的类
router.register(r'products', views.ProductsViewSet)
router.register(r'login', views.UserProfileViewSet)
router.register(r'register', views.UserProfileViewSet)

urlpatterns = [
  # re_path(r'^api-auth', include("rest_framework.urls", namespace="reset_framework")),
  re_path(r'^jwt_auth/', obtain_jwt_token),
  re_path(r'^', include(router.urls)),
]
